<%-- 
    Document   : admin_gerenciar_adrs_fora_do_prazo
    Created on : 04/03/2011, 14:31:52
    Author     : Welligton
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="br.ufc.quixada.adrs.model.Adrs" %>
<%@page import="java.util.List" %>
<%@include file="admin_seguranca.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<%
            List<Adrs> listaAdrs = (List<Adrs>) session.getAttribute("adrsForaPrazo");
            List<Adrs> adrs = (List<Adrs>) session.getAttribute("listaAdrsPrazo");
            session.removeAttribute("listaAdrsPrazo");
%>
<link rel="stylesheet" type="text/css" href="../css/style.css"/>
<link rel="stylesheet" type="text/css" href="css/stylePrint.css" media="print"/>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Sistema ADRS - Módulo Administrador</title>
        <script language="JavaScript" type="text/JavaScript">
            ok=false;
            function CheckAll() {
                if(!ok){
                    for (var i=0;i<document.form1.elements.length;i++) {
                        var x = document.form1.elements[i];
                        if (x.name == 'cb') {
                            x.checked = true;
                            ok=true;
                        }
                    }
                }
                else{
                    for (var i=0;i<document.form1.elements.length;i++) {
                        var x = document.form1.elements[i];
                        if (x.name == 'cb') {
                            x.checked = false;
                            ok=false;
                        }
                    }
                }
            }
        </script>
    </head>
    <body>
        <%@include file="../imagemBB.jsp" %>
        <h1>Sistema ADRS - Módulo Administrador</h1>
        <%@include file="admin_menu_tres.jsp" %>
        <div id="content">
            <h2 class="titulo">Gerenciamento de Prazos - Adicionar ADRS a prazo pendente</h2>
            <%@include file="/error.jsp"%>
            <center>
                <br/><h4>Buscar Adrs por nome:</h4>
                <form action="../ServletCentral" method="POST">
                    <input type="hidden" name="comando" value="CmdAddAdrsPorNomePrazo">
                    <label>Nome: </label><input type="text" name="nome_busca">
                    <input type="submit" name="btnBuscar" value="Buscar" class="button"><br><br>
                </form>
            </center>
            <form name="form1" action="../ServletCentral?comando=CmdAddAdrsPrazo" method="POST">
                <div>
                    <% if (adrs != null && adrs.size() > 0) {%>
                    <table>
                        <thead>
                            <tr>
                                <th colspan="2">Resultado da busca:</th>
                            </tr>
                            <tr>
                                <th>Incluir ADRS</th>
                                <th>Nome ADRS</th>
                            </tr>
                        </thead>
                        <tbody>
                            <% for (Adrs ad : adrs) {%>
                            <tr>
                                <td class="centerNoPrint">
                                    <input type="checkbox" name="cb2" value="<%=ad.getId()%>"/>
                                </td>
                                <td><%=ad.getUsuario().getNome()%></td>
                            </tr>
                            <%}%>
                        </tbody>
                    </table>
                    <% }%>
                </div>
                <br/><hr>
                <div>
                    <%if (listaAdrs == null || listaAdrs.size() == 0) {%>
                    <br><p class="mensagemErro">Não há ADRS fora deste prazo</p>
                    <%} else {%>
                    <br/>
                    <br/>
                    <center><h4>ADRS's que não estão sob influência deste prazo no momento</h4></center>
                    <table>
                        <thead>
                            <tr>
                                <th colspan="2">Lista de ADRS's que não estão incluídos neste prazo</th>
                            </tr>
                            <tr>
                                <th>Incluir ADRS</th>
                                <th>Nome ADRS</th>
                            </tr>
                        </thead>
                        <tbody>
                            <%  for (Adrs a : listaAdrs) {%>
                            <tr>
                                <td class="centerNoPrint">
                                    <input type="checkbox" name="cb" value="<%=a.getId()%>" />
                                </td>
                                <td><%=a.getUsuario().getNome()%></td>
                            </tr>
                            <%}%>
                        </tbody>
                    </table>
                    <%}%>
                    <br/>
                    <a href="javascript:void(null)" onClick="CheckAll();" class="button2">Selecionar Todos</a>
                    <input type="submit" name="envia" value="Incluir ADRS Selecionados" class="button" />
                </div>
            </form>
            <br/><hr><br/>
            <div class="no-print">
                <a href="" onclick="javascript:history.back(); return false;" title="Voltar" class="button2">Voltar</a>
            </div>
        </div>
        <%@include file="../footer.jsp" %>
    </body>
</html>
